package com.wxsong.authplatform.authweb.dao.userrole;

import com.wxsong.authplatform.authweb.dao.BaseDao;
import com.wxsong.authplatform.authweb.model.userrole.UserRole;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UserRoleDao extends BaseDao {
    public List<UserRole> getByUserId(Long userId) {
        return this.getSqlSession().selectOne("UserRoleMap.selectByUserId", userId);
    }

    public UserRole getById(Long id) {
        return this.getSqlSession().selectOne("UserRoleMap.selectById", id);
    }

    public int add(UserRole userRole) {
        return this.getSqlSession().insert("UserRoleMap.insert", userRole);
    }

    public int update(UserRole userRole) {
        return this.getSqlSession().update("UserRoleMap.update", userRole);
    }

    public int delete(Long id) {
        return this.getSqlSession().delete("UserRoleMap.delete", id);
    }

    public int deleteByUserId(Long userId) {
        return this.getSqlSession().delete("UserRoleMap.deleteByUserId", userId);
    }
}
